
#pragma once

#include <cstdint>
#include <cstring>
#include <string>
#include <memory>
#include <iostream>
#include <vector>
#include <set>
#include "loop_event.hpp"
#include "stun_message.h"
#include "turn_client_main/file_operation.h"
#include "udp_client.h"

struct LostPacketIndex
{
	std::vector<int> m_lost_packet_index_vec;
	uint32_t m_order_packet_index{0};
	std::set<uint32_t> m_packet_index_set;
};

struct PeerClientInformation
{
	// srfix
	std::string m_srfix_ip;
	uint16_t    m_srfix_port{0};

	FileOperation m_file_operation;
	// allocate addrinformation
	std::string m_ip;
	uint16_t    m_port{0};
	UdpClient   * m_relay_client{nullptr};
	LostPacketIndex m_lost_packet;
};


void PeerProcessBindResponse(LoopEvent * loop_event, UdpClient * client, StunMessage & message, PeerClientInformation & information);

void ProcessDataFromRelayServer(LoopEvent * loop_event, UdpClient * client, PeerClientInformation & information, UdpBufferPacket * packet);

void TestAllocate(LoopEvent * loop_event,PeerClientInformation & information);